package kit.edu.lego.gruppe3.levels.treeArea.old;

import kit.edu.lego.gruppe3.ComponentsRepository;
import kit.edu.lego.gruppe3.LegoMain;
import kit.edu.lego.gruppe3.actions.Movement;
import kit.edu.lego.gruppe3.levels.LevelSelector;
import kit.edu.lego.gruppe3.levels.LevelSelector.Level;
import kit.edu.lego.gruppe3.sensors.*;
import lejos.robotics.subsumption.Behavior;

public class ExitFinder implements Behavior {

	private double length = ComponentsRepository.VEHICLE_LENGTH;

	@Override
	public void action() {
		Movement.travel(length, 10);
		TreeAreaSolver.setLevelCleared(true);
		LegoMain.startNextSolver();
	}

	@Override
	public void suppress() {
	}

	@Override
	public boolean takeControl() {
		return Level.treeArea == LevelSelector.getInstance().getCurrentLevel()
				&& TreeAreaState.searchForExit == TreeAreaSolver.getStatus();
	}

	/*
	 * private boolean checkFound(){ int[] lineCount = Scanner.countLines();
	 * if(lineCount[0]+lineCount[1] > 2) return true; return false; }
	 */
}
